<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {% load static %}
    <link rel="stylesheet" href="{% static 'polls/style.css' %}">
    <title>{{ question.question_text }} - 投票结果</title>
</head>
<body>
    <div class="container">
        <h1>{{ question.question_text }}</h1>

        <!-- 新增的总投票数统计 -->
        <div class="total-votes-container">
            <span class="total-votes-label">总投票数:</span>
            <span class="total-votes-count">{{ question.total_votes }} 票</span>
        </div>

        <ul class="results-list">
            {% for choice in question.choice_set.all %}
            <li class="result-item" style="--votes: {{ choice.votes }}; --total-votes: {{ question.total_votes }};">
                <span>
                    <span>{{ choice.choice_text }}</span>
                    <span>{{ choice.votes }} 票 ({{ choice.percentage }}%)</span>
                </span>
            </li>
            {% endfor %}
        </ul>

        <div class="action-buttons">
            <a href="{% url 'polls:detail' question.id %}" class="action-btn revote-btn">重新投票</a>
            <a href="{% url 'polls:index' %}" class="action-btn home-btn">返回首页</a>
        </div>
    </div>

    <div class="admin-link">
        <a href="/admin/" class="btn btn-accent">管理后台</a>
    </div>
</body>
</html>